package com.ruoyi.business.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.business.service.IBusHardwareStatusCommonUpdateService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusSensorMapper;
import com.ruoyi.business.domain.BusSensor;
import com.ruoyi.business.service.IBusSensorService;

/**
 * 易损耗传感器Service业务层处理
 * 
 * @author asher
 * @date 2021-10-14
 */
@Service
public class BusSensorServiceImpl implements IBusSensorService, IBusHardwareStatusCommonUpdateService
{
    @Autowired
    private BusSensorMapper busSensorMapper;

    /**
     * 查询易损耗传感器
     * 
     * @param sensorId 易损耗传感器主键
     * @return 易损耗传感器
     */
    @Override
    public BusSensor selectBusSensorBySensorId(Long sensorId)
    {
        return busSensorMapper.selectBusSensorBySensorId(sensorId);
    }

    /**
     * 查询易损耗传感器列表
     * 
     * @param busSensor 易损耗传感器
     * @return 易损耗传感器
     */
    @Override
    public List<BusSensor> selectBusSensorList(BusSensor busSensor)
    {
        return busSensorMapper.selectBusSensorList(busSensor);
    }

    /**
     * 新增易损耗传感器
     * 
     * @param busSensor 易损耗传感器
     * @return 结果
     */
    @Override
    public int insertBusSensor(BusSensor busSensor)
    {
        busSensor.setCreateTime(DateUtils.getNowDate());
        return busSensorMapper.insertBusSensor(busSensor);
    }

    /**
     * 修改易损耗传感器
     * 
     * @param busSensor 易损耗传感器
     * @return 结果
     */
    @Override
    public int updateBusSensor(BusSensor busSensor)
    {
        busSensor.setUpdateTime(DateUtils.getNowDate());
        return busSensorMapper.updateBusSensor(busSensor);
    }

    /**
     * 批量删除易损耗传感器
     * 
     * @param sensorIds 需要删除的易损耗传感器主键
     * @return 结果
     */
    @Override
    public int deleteBusSensorBySensorIds(Long[] sensorIds)
    {
        return busSensorMapper.deleteBusSensorBySensorIds(sensorIds);
    }

    /**
     * 删除易损耗传感器信息
     * 
     * @param sensorId 易损耗传感器主键
     * @return 结果
     */
    @Override
    public int deleteBusSensorBySensorId(Long sensorId)
    {
        return busSensorMapper.deleteBusSensorBySensorId(sensorId);
    }

    @Override
    public int updateStatusByDestRecordId(Long destRecordId, int destStatus, Date updateTime) {
        return busSensorMapper.updateStatusByDestRecordId(destRecordId, destStatus, updateTime);
    }
}
